package com.filepublic.demo.server.mapper;

import com.filepublic.demo.pojo.entity.EmailEntity;
import com.filepublic.demo.pojo.vo.EmailVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface EmailBaseMapper {
    /**
     * 插入email
     * @param emailEntity
     */
    @Insert("insert into email_table values(" +
            "#{emailId},#{emailOwnerId},#{emailSenderId},#{fileId}," +
            "#{emailTitle},#{emailText},#{emailTextPath},#{sendDate}," +
            "#{emailRead},#{emailStar})")
    void insertEmail(EmailEntity emailEntity);

    /**
     * 通过用户id查找邮件
     * @param userId
     * @return
     */
    List<EmailVo> selectEmailById(@Param("userId") String userId);

    /**
     * 基础更新
     * @param emailEntity
     */
    void updateBase(EmailEntity emailEntity);
}
